/**
 * 
 */
package org.cuny.sensorslection;

/**
 * @author Susan Su
 *
 */
public class SensorSelectionTest
{
	/**
	 * Create test factory
	 */
	private static ISensorSelectionFactory MOCKUP_FACTORY = new ISensorSelectionFactory()
	{
		public Sensor[] createSensors()
		{
			return new Sensor[] {
				new Sensor( 1,4,20 ), new Sensor( 2,5,10 ), new Sensor( 3,500,20 )					
			};
		}
	};
	
	private static int BUDGET = 10;
	
	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		ISensorSelector selector = new DynamicSelector();
		new SensorSelectionTest().printSelectedSensors(
				selector.calculate( MOCKUP_FACTORY.createSensors(), BUDGET ) );
	}

	/**
	 * @param selectedSensors
	 */
	private void printSelectedSensors( Sensor[] selectedSensors )
	{
		int sensorNumber = selectedSensors.length;
		int totalCost = 0;
		System.out.println( "There are " + sensorNumber + " sensors selected." );
		for( int i = 0; i < sensorNumber; i++ )
		{
			System.out.println( "Sensor " + selectedSensors[ i ].getId() + " has been selected." );
			totalCost += selectedSensors[ i ].getCost();
		}
		System.out.println( "The total cost of current sensors set is " + totalCost );
	}
}
